package com.foreverwin.mes.generator;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
import com.baomidou.mybatisplus.generator.config.querys.OracleQuery;
import com.foreverwin.mes.generator.converts.HanaTypeConvert;
import com.foreverwin.mes.generator.querys.HanaQuery;

/**
 * @author Ervin Chen
 * @date 2019/12/30 13:49
 */
public class GeneratorApplication {
    public static void main(String[] args) {
//        SpringApplication app = new SpringApplication(GeneratorApplication.class);
//        app.setBannerMode(Banner.Mode.OFF);
//        app.run(args);

        generateCode();
    }

    public static void generateCode(){
        MpGenerator.MpGeneratorBuilder mpGeneratorBuilder = MpGenerator.builder();
        DataSourceConfig dataSourceConfig = new DataSourceConfig();
        dataSourceConfig.setDbType( DbType.ORACLE );
        dataSourceConfig.setDriverName( "com.sap.db.jdbc.Driver" );
        dataSourceConfig.setUrl( "jdbc:sap:192.168.18.230:39015" );
        dataSourceConfig.setUsername( "WIP" );
        dataSourceConfig.setPassword( "Sap12345" );
        dataSourceConfig.setDbQuery( new HanaQuery() );
        dataSourceConfig.setTypeConvert( new HanaTypeConvert() );
        MpGenerator mpGenerator = mpGeneratorBuilder.dataSourceConfig(dataSourceConfig)
                .tablePrefix( "ZD_", "ZR_", "Z_" )
                .packageName( "com.foreverwin.mes.so" )
                .tables("Z_SHOP_ORDER_DISPATCH_DETAIL")
                .author("Syngna")
                .build();
        mpGenerator.execute();
    }
}
